intro
‘ONs’
## network ----
d_subj_netw <- get_trial_data("network_errts") %>% get_ons
## plot:
d_subj_netw %>%
ggplot(aes(roi, on)) +
geom_hline(yintercept = 0) +
stat_summary(aes(fill = task), fun = "mean", geom = "col", width = 0.5, position = position_dodge(width = 0.5)) +
stat_summary(
fun.data = "mean_cl_boot", geom = "errorbar", width = 0, size = 1.5, position = position_dodge(width = 0.5)
) +
facet_grid(vars(task), scales = "free_y") +
scale_fill_brewer(type = "qual", palette = 2) +
theme(legend.position = 'none') +
labs(y = "Mean ONs contrast (b)", x = "Network (Schaefer 7)")

## parcel ----
d_subj_parc_on <- get_trial_data("parcel_errts") %>% get_ons
## get parcel t-stats:
d_group_parc_on <- d_subj_parc_on[, .(tstat = t.test(on)$statistic, p = t.test(on)$p.value), by = c("task", "roi")]
d_group_parc_on[, p_fdr := p.adjust(p, "fdr"), by = task] ## adjust p val
d_group_parc_on[, roi_ind := match(roi, key_schaefer$parcel)] ## bind indices
unthresholded
for task_i in range(len(r.tasks)):
# task_i = 0
## get task:
is_task_i = r.d_group_parc_on.task == r.tasks[task_i]
d_on = r.d_group_parc_on[is_task_i]
## get overlay:
overlay_on_lh = get_overlay(d_on.roi_ind, d_on.tstat, "left")
overlay_on_rh = get_overlay(d_on.roi_ind, d_on.tstat, "right")
overlay_on = np.column_stack(np.stack((overlay_on_lh, overlay_on_rh)))
## plot:
fig = plot_surf_roi_montage(roi_map = overlay_on, title = r.tasks[task_i])
plotting.show()
fig.clear()
plt.close('all')
## <string>:30: UserWarning: This figure includes Axes that are not compatible with tight_layout, so results might be incorrect.
## <string>:30: UserWarning: This figure includes Axes that are not compatible with tight_layout, so results might be incorrect.
## <string>:30: UserWarning: This figure includes Axes that are not compatible with tight_layout, so results might be incorrect.
## <string>:30: UserWarning: This figure includes Axes that are not compatible with tight_layout, so results might be incorrect.




hi – lo
## network ----
d_subj_netw <- get_trial_data("network_errts") %>% get_hilo
## plot:
d_subj_netw %>%
ggplot(aes(roi, hi_v_lo)) +
geom_hline(yintercept = 0) +
stat_summary(aes(fill = task), fun = "mean", geom = "col", width = 0.5, position = position_dodge(width = 0.5)) +
stat_summary(
fun.data = "mean_cl_boot", geom = "errorbar", width = 0, size = 1.5, position = position_dodge(width = 0.5)
) +
facet_grid(vars(task), scales = "free_y") +
scale_fill_brewer(type = "qual", palette = 2) +
theme(legend.position = 'none') +
labs(y = "Mean hi vs lo contrast (b)", x = "Network (Schaefer 7)")

## parcel ----
d_subj_parc_hilo <- get_trial_data("parcel_errts") %>% get_hilo
## plot MD parcels:
d_subj_parc_hilo[roi %in% key_schaefer[schaefermd]$parcel] %>%
ggplot(aes(task, hi_v_lo, fill = task)) +
geom_hline(yintercept = 2) +
stat_summary(fun = function(x) t.test(x)$statistic, geom = "col", width = 0.5, position = position_dodge(width = 0.5)) +
facet_wrap(vars(roi)) +
scale_fill_brewer(type = "qual", palette = 2) +
theme(legend.position = 'none', axis.text.x = element_blank()) +
labs(y = "Mean hi vs lo contrast (t-stat)", title = "Schaeferized MMP-MD", x = "Task (alphabetical)")

## plot surfaces
## get parcel t-stats:
d_group_parc_hilo <- d_subj_parc_hilo[, .(tstat = t.test(hi_v_lo)$statistic, p = t.test(hi_v_lo)$p.value),
by = c("task", "roi")]
d_group_parc_hilo[, p_fdr := p.adjust(p, "fdr"), by = task] ## adjust p val
d_group_parc_hilo[, roi_ind := match(roi, key_schaefer$parcel)] ## bind indices